package com.ruoyi.web.controller.compensationManagement;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.compensationManagement.domain.CompensationSalaryProjectManagement;
import com.ruoyi.compensationManagement.service.ICompensationSalaryProjectManagementService;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 薪资项目管理Controller
 * 
 * @author ruoyi
 * @date 2022-10-09
 */
@RestController
@RequestMapping("/compensationManagement/salaryProjectManagement")
public class CompensationSalaryProjectManagementController extends BaseController
{
    @Autowired
    private ICompensationSalaryProjectManagementService compensationSalaryProjectManagementService;

    /**
     * 查询薪资项目管理列表
     */
    @PreAuthorize("@ss.hasPermi('compensationManagement:salaryProjectManagement:list')")
    @GetMapping("/list")
    public AjaxResult list(CompensationSalaryProjectManagement compensationSalaryProjectManagement)
    {
        List<CompensationSalaryProjectManagement> list = compensationSalaryProjectManagementService.selectCompensationSalaryProjectManagementList(compensationSalaryProjectManagement);
        return AjaxResult.success(list);
    }

    /**
     * 导出薪资项目管理列表
     */
    /*@PreAuthorize("@ss.hasPermi('compensationManagement:salaryProjectManagement:export')")
    @Log(title = "薪资项目管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CompensationSalaryProjectManagement compensationSalaryProjectManagement)
    {
        List<CompensationSalaryProjectManagement> list = compensationSalaryProjectManagementService.selectCompensationSalaryProjectManagementList(compensationSalaryProjectManagement);
        ExcelUtil<CompensationSalaryProjectManagement> util = new ExcelUtil<CompensationSalaryProjectManagement>(CompensationSalaryProjectManagement.class);
        util.exportExcel(response, list, "薪资项目管理数据");
    }*/

    /**
     * 获取薪资项目管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('compensationManagement:salaryProjectManagement:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(compensationSalaryProjectManagementService.selectCompensationSalaryProjectManagementById(id));
    }

    /**
     * 新增薪资项目管理
     */
    @PreAuthorize("@ss.hasPermi('compensationManagement:salaryProjectManagement:add')")
    @Log(title = "薪资项目管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CompensationSalaryProjectManagement compensationSalaryProjectManagement)
    {
        return toAjax(compensationSalaryProjectManagementService.insertCompensationSalaryProjectManagement(compensationSalaryProjectManagement));
    }

    /**
     * 修改薪资项目管理
     */
    @PreAuthorize("@ss.hasPermi('compensationManagement:salaryProjectManagement:edit')")
    @Log(title = "薪资项目管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CompensationSalaryProjectManagement compensationSalaryProjectManagement)
    {
        return toAjax(compensationSalaryProjectManagementService.updateCompensationSalaryProjectManagement(compensationSalaryProjectManagement));
    }

    /**
     * 删除薪资项目管理
     */
    @PreAuthorize("@ss.hasPermi('compensationManagement:salaryProjectManagement:remove')")
    @Log(title = "薪资项目管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(compensationSalaryProjectManagementService.deleteCompensationSalaryProjectManagementByIds(ids));
    }
}
